//k1 edit 2021.12.18

if (!isServer) exitwith {};

private ["_center", "_staticWeaponClasses", "_parkedVehicleClasses"];
private ["_object", "_pos", "_marker", "_instanceNo", "_randomNo", "_gun", "_angle", "_car"];
_center = _this select 0;

_staticWeaponClasses = _this select 1;
_parkedVehicleClasses = _this select 2;
private _rotation = random 360;

[_center,30] call a3e_fnc_cleanupTerrain;

if (isNil "drn_BuildAmmoDepot_MarkerInstanceNo") then {
	drn_BuildAmmoDepot_MarkerInstanceNo = 0;
} else {
	drn_BuildAmmoDepot_MarkerInstanceNo = drn_BuildAmmoDepot_MarkerInstanceNo + 1;
};
_instanceNo = drn_BuildAmmoDepot_MarkerInstanceNo;

_fnc_createObject = {
    params ["_className","_centerPos","_relativePos","_rotateDir","_relativeDir"];
    private ["_object", "_realPos", "_realDir"];

    _fnc_rotatePos = {
        private ["_centerPos", "_pos", "_dir"];
        private ["_px", "_py", "_mpx", "_mpy", "_ma", "_rpx", "_rpy"];
        _centerPos = _this select 0;
        _pos = _this select 1;
        _dir = _this select 2;
        _px = _pos select 0;
        _py = _pos select 1;
        _mpx = _centerPos select 0;
        _mpy = _centerPos select 1;
        _ma = _dir;
        _rpx = ( (_px - _mpx) * cos(_ma) ) + ( (_py - _mpy) * sin(_ma) ) + _mpx;
        _rpy = (-(_px - _mpx) * sin(_ma) ) + ( (_py - _mpy) * cos(_ma) ) + _mpy;
        [_rpx, _rpy, (_pos select 2)];
    };

    _realPos = ([_centerPos, [(_centerPos select 0) + (_relativePos select 0), (_centerPos select 1) + (_relativePos select 1),(_relativePos select 2)], _rotateDir] call _fnc_rotatePos);
    _object = createVehicle [_className, _realPos, [], 0, "CAN_COLLIDE"];
    _object setdir (_relativeDir + _rotateDir);
    _object setPosATL _realPos;
    _object
};

_obj = ['Land_LampShabby_F',_center,[-8.8,-8.5,0],_rotation,225] call _fnc_createObject;
_obj = ['Land_LampShabby_F',_center,[-8.8,7.5,0],_rotation,322] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-11.4,8.7,4.3],_rotation,29] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-9.9,11.5,4.3],_rotation,200] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12,10.7,4.2],_rotation,114] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.9,-12.4,4.2],_rotation,51] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-14.1,-0.3,0],_rotation,90] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.6,-2.1,0],_rotation,6] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.6,1.3,0.4],_rotation,176] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.7,-2.1,0.4],_rotation,6] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-6.1,10.7,0],_rotation,96] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.7,-10.1,4.2],_rotation,137] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-10.6,-12.8,4.2],_rotation,326] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-14.2,-0.3,0.4],_rotation,90] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-6.1,10.5,0.4],_rotation,90] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-12.5,1.3,0],_rotation,177] call _fnc_createObject;
_obj = ['Land_HBarrierTower_F',_center,[-10.6,-10.1,0],_rotation,50] call _fnc_createObject;
_obj = ['Land_HBarrierTower_F',_center,[-9.9,9.3,0],_rotation,141] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-16.8,10.9,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-16.8,-8.9,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-16.7,-11.4,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-11.4,-16.8,0],_rotation,180] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-16.9,1,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.6,3.8,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.7,-1.8,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.6,-8.6,0],_rotation,180] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.7,-8.7,2.5],_rotation,180] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.7,-1.7,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.5,7.1,1],_rotation,1] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.7,3.7,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.6,-1.9,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.6,-5.4,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.7,-5.3,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.7,-5.4,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-8.6,3.6,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.6,-8.7,1.5],_rotation,180] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.5,7.1,2.5],_rotation,1] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-6.5,7.2,0],_rotation,1] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[-8.7,3.3,3.7],_rotation,90] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[-8.6,-4.4,3.7],_rotation,270] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-11.3,16.4,0],_rotation,360] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-10.7,16.4,0],_rotation,0] call _fnc_createObject;
_obj = ['Land_LampShabby_F',_center,[8.1,-8.4,0],_rotation,120] call _fnc_createObject;
_obj = ['Land_LampShabby_F',_center,[8.1,7.1,0],_rotation,47] call _fnc_createObject;
_obj = ['Land_CncShelter_F',_center,[-0.7,7.2,0.3],_rotation,0] call _fnc_createObject;
_obj = ['Land_BagBunker_Large_F',_center,[-0.1,-1.5,0],_rotation,181] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[11.4,0.7,0.5],_rotation,184] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[1.3,-12.5,0.5],_rotation,275] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[10.7,11.1,4.2],_rotation,210] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-2.1,-12.5,0],_rotation,84] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[12.3,-12.6,4.2],_rotation,314] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[11.2,-2.8,0],_rotation,357] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[12.9,-1.1,0.4],_rotation,269] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[12.5,-10.4,4.3],_rotation,233] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-0.4,-14,0.5],_rotation,359] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[10.2,-12.7,4.3],_rotation,43] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[11.3,8.8,4.2],_rotation,297] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-2.7,10.7,0.4],_rotation,260] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[3.7,12.2,0.4],_rotation,176] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[5.5,10.7,0.4],_rotation,263] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[2.1,10.6,0.4],_rotation,92] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[8.4,10.7,4.2],_rotation,126] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-0.4,-14.1,0],_rotation,358] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[3.7,12.2,0],_rotation,175] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[1.3,-12.5,0],_rotation,274] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[5.5,10.7,0],_rotation,262] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-2.1,-12.4,0.4],_rotation,86] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[2.1,10.6,0],_rotation,91] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[12.9,-1.1,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-4.3,12.2,0],_rotation,180] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[11.4,0.6,0],_rotation,186] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-2.6,10.5,0],_rotation,267] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[11.3,-2.8,0.5],_rotation,355] call _fnc_createObject;
_obj = ['Land_BagFence_Round_F',_center,[-4.5,12.1,0.4],_rotation,174] call _fnc_createObject;
_obj = ['Land_HBarrierTower_F',_center,[9.8,9.1,0],_rotation,222] call _fnc_createObject;
_obj = ['Land_HBarrierTower_F',_center,[9.9,-10.4,0],_rotation,314] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[8.4,-17,0],_rotation,181] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[16.1,-1.7,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[-1.6,-16.9,0],_rotation,181] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[11.6,-17,0],_rotation,181] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[16.1,8.3,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[16.2,-11.6,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[16.1,10.9,0],_rotation,269] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,3.5,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-1.3,-8.6,0],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[6.1,7.1,2.5],_rotation,359] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-4.5,7.1,1],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3.1,7,2.5],_rotation,1] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[5.9,-8.5,0],_rotation,181] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,3.6,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-1.4,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3.3,-8.6,0],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-6.6,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-1.2,-8.8,1.5],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.2,3.5,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-6.5,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-0.8,7.2,2.6],_rotation,0] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[6.1,7,1.5],_rotation,359] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[5.9,-8.6,2.5],_rotation,181] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-4.5,7.1,2.5],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-6.6,1.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[6,-8.7,1.5],_rotation,181] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-1.2,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3.1,7.1,1.4],_rotation,1] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[6.1,7.2,0],_rotation,359] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-4.5,7.1,0],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3,7.1,0],_rotation,1] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[8.1,-1.3,2.5],_rotation,270] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3.3,-8.7,1.5],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[-1.3,-8.7,2.5],_rotation,179] call _fnc_createObject;
_obj = ['Land_HBarrier_5_F',_center,[3.2,-8.7,2.5],_rotation,179] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[-4.9,-8.6,3.6],_rotation,2] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[-3.2,6.9,3.8],_rotation,1] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[4.6,6.9,3.8],_rotation,181] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[8.1,-4.8,3.7],_rotation,271] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[2.8,-8.6,3.6],_rotation,181] call _fnc_createObject;
_obj = ['Land_Razorwire_F',_center,[8,3,3.7],_rotation,91] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[9.3,16.3,0],_rotation,1] call _fnc_createObject;
_obj = ['Land_New_WiredFence_10m_F',_center,[11.3,16.2,0],_rotation,1] call _fnc_createObject;
_obj = ['Land_Mil_WiredFence_Gate_F',_center,[-0.7,16.1,0],_rotation,0] call _fnc_createObject;

//固定武器
_MGGMH = a3e_arr_Escape_SWC_MG_H + a3e_arr_Escape_SWC_GM_H;
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-12.2,-0.2,0],_rotation,271] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-12,-10.8,2.3],_rotation,233] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-11,10.7,2.3],_rotation,317] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-0.7,-12.4,0],_rotation,182] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[4.1,10.6,0],_rotation,0] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[11.3,-1.2,0],_rotation,91] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[11.1,-11.7,2.3],_rotation,135] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-4.4,9.9,0],_rotation,0] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[11,9.8,2.3],_rotation,45] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_MGGM = a3e_arr_Escape_SWC_MG + a3e_arr_Escape_SWC_GM;
_gun = selectRandom _MGGM;
_obj = [_gun,_center,[-3.1,2.7,2.3],_rotation,360] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGM;
_obj = [_gun,_center,[3.3,-4.3,2.3],_rotation,0] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_MGA = a3e_arr_Escape_SWC_MG_A;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[-6.8,-6.2,0.1],_rotation,28] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[-6,4.7,0.1],_rotation,113] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[3.9,2.5,2.3],_rotation,35] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[6.1,-6.3,0.1],_rotation,325] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[5.9,4.8,0.1],_rotation,269] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[-3.4,-4.5,2.3],_rotation,237] call _fnc_createObject;
Escape_allStatics pushback _obj;

_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[-11.6,-11.3,4.2],_rotation,225] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[9.9,9.1,4.2],_rotation,44] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[-10.5,10,4.2],_rotation,335] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[11.2,-11.4,4.2],_rotation,127] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_gun = selectRandom a3e_arr_MortarSite;
_obj = [_gun,_center,[0,1.6,2.2],_rotation,0] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_MortarSite;
_obj = [_gun,_center,[-2.4,-2.1,2.2],_rotation,0] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_MortarSite;
_obj = [_gun,_center,[1.9,-1.8,2.2],_rotation,360] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];

//veh
_parkedVehicleClasses append ["C_Heli_Light_01_civil_F","B_Heli_Light_01_F","I_Heli_light_03_unarmed_F"];
_parkedVehicleClasses append ["O_Heli_Light_02_unarmed_F","C_IDAP_Heli_Transport_02_F"];
_veh = if(random 10 > 1)then[{selectRandom _parkedVehicleClasses},{""}];
if (_veh != "") then {
	_obj = [_veh,_center,[26,7.4,-0.1],_rotation,0] call _fnc_createObject;
	if !(_obj isKindOf "air") then {[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner};
	Escape_all_assets pushback _obj;
	_obj setVariable ["Escape_assets_control", true, true];
};

    //Basic Weapon Box
    _weapons = [];
    _weaponMagazines = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotBasicWeapons - 1) do {
        private ["_handGunItem", "_weaponClassName", "_probabilityOfPrecence", "_minCount", "_maxCount", "_magazines", "_magazinesPerWeapon"];
        _handGunItem = a3e_arr_AmmoDepotBasicWeapons select _i;
        _weaponClassName = _handGunItem select 0;
        _probabilityOfPrecence = _handGunItem select 1;
        _minCount = _handGunItem select 2;
        _maxCount = _handGunItem select 3;
        _magazines = _handGunItem select 4;
        _magazinesPerWeapon = _handGunItem select 5;
        if (random 100 <= _probabilityOfPrecence) then {
            _weaponCount = floor (_minCount + random (_maxCount - _minCount));
            _weapons pushBack [_weaponClassName, _weaponCount];
            for "_j" from 0 to (count _magazines) - 1 do {
                _weaponMagazines pushBack [_magazines select _j, _weaponCount * _magazinesPerWeapon];
            };
        };
    };
    if (count _weapons > 0 || {count _weaponMagazines > 0}) then {
		_box = ["Box_East_Wps_F",_center,[1.9,-1.4,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addWeaponCargoGlobal _x} foreach _weapons;
        {_box addMagazineCargoGlobal _x} foreach _weaponMagazines;
    };

    //Special Weapon Box
    _weapons = [];
    _weaponMagazines = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotSpecialWeapons - 1) do {
        private ["_handGunItem", "_weaponClassName", "_probabilityOfPrecence", "_minCount", "_maxCount", "_magazines", "_magazinesPerWeapon"];
        _handGunItem = a3e_arr_AmmoDepotSpecialWeapons select _i;
        _weaponClassName = _handGunItem select 0;
        _probabilityOfPrecence = _handGunItem select 1;
        _minCount = _handGunItem select 2;
        _maxCount = _handGunItem select 3;
        _magazines = _handGunItem select 4;
        _magazinesPerWeapon = _handGunItem select 5;
        if (random 100 <= _probabilityOfPrecence) then {
            _weaponCount = floor (_minCount + random (_maxCount - _minCount));
            _weapons pushBack [_weaponClassName, _weaponCount];
            for "_j" from 0 to (count _magazines) - 1 do {
                _weaponMagazines pushBack [_magazines select _j, _weaponCount * _magazinesPerWeapon];
            };
        };
    };
    if (count _weapons > 0 || {count _weaponMagazines > 0}) then {
		_box = ["Box_East_WpsLaunch_F",_center,[-1.6,-0.2,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addWeaponCargoGlobal _x} foreach _weapons;
        {_box addMagazineCargoGlobal _x} foreach _weaponMagazines;
    };
	
    //Ordnance
    _weapons = [];
    _weaponMagazines = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotOrdnance - 1) do {
        private ["_handGunItem", "_weaponClassName", "_probabilityOfPrecence", "_minCount", "_maxCount", "_magazines", "_magazinesPerWeapon"];
        _handGunItem = a3e_arr_AmmoDepotOrdnance select _i;
        _weaponClassName = _handGunItem select 0;
        _probabilityOfPrecence = _handGunItem select 1;
        _minCount = _handGunItem select 2;
        _maxCount = _handGunItem select 3;
        _magazines = _handGunItem select 4;
        _magazinesPerWeapon = _handGunItem select 5;
        if (random 100 <= _probabilityOfPrecence) then {
            _weaponCount = floor (_minCount + random (_maxCount - _minCount));
            for "_j" from 0 to (count _magazines) - 1 do {
                _weaponMagazines pushBack [_magazines select _j, _weaponCount * _magazinesPerWeapon];
            };
        };
    };
    if (count _weapons > 0 || {count _weaponMagazines > 0}) then {
		_box = ["Box_East_WpsSpecial_F",_center,[1.9,0,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addWeaponCargoGlobal _x} foreach _weapons;
        {_box addMagazineCargoGlobal _x} foreach _weaponMagazines;
    };

    //Vehicle
    _weapons = [];
    _weaponMagazines = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotVehicle - 1) do {
        private ["_handGunItem", "_weaponClassName", "_probabilityOfPrecence", "_minCount", "_maxCount", "_magazines", "_magazinesPerWeapon"];
        _handGunItem = a3e_arr_AmmoDepotVehicle select _i;
        _weaponClassName = _handGunItem select 0;
        _probabilityOfPrecence = _handGunItem select 1;
        _minCount = _handGunItem select 2;
        _maxCount = _handGunItem select 3;
        _magazines = _handGunItem select 4;
        _magazinesPerWeapon = _handGunItem select 5;
        if (random 100 <= _probabilityOfPrecence) then {
            _weaponCount = floor (_minCount + random (_maxCount - _minCount));
            _weapons pushBack [_weaponClassName, _weaponCount];
            for "_j" from 0 to (count _magazines) - 1 do {
                _weaponMagazines pushBack [_magazines select _j, _weaponCount * _magazinesPerWeapon];
            };
        };
    };
	_items = [];
	for "_i" from 0 to (count a3e_arr_AmmoDepotVehicleItems - 1) do {
        private ["_item", "_itemClassName", "_probabilityOfPrecence", "_minCount", "_maxCount"];
        _item = a3e_arr_AmmoDepotVehicleItems select _i;
        _itemClassName = _item select 0;
        _probabilityOfPrecence = _item select 1;
        _minCount = _item select 2;
        _maxCount = _item select 3;
        if (random 100 <= _probabilityOfPrecence) then {
            _itemCount = floor (_minCount + random (_maxCount - _minCount));
            _items pushback [_itemClassName, _itemCount];
        };
    };
    if (count _weapons > 0 || {count _weaponMagazines > 0} || {count _items > 0}) then {
		_box = ["Box_East_Wps_F",_center,[1.8,-2.7,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addWeaponCargoGlobal _x} foreach _weapons;
        {_box addMagazineCargoGlobal _x} foreach _weaponMagazines;
		{_box addBackpackCargoGlobal [_x,4]} foreach a3e_arr_AmmoDepotVehicleBackpacks;
		{_box addItemCargoGlobal _x} foreach _items;
    };
	
    //Items
    _weapons = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotItems - 1) do {
        private ["_item", "_itemClassName", "_probabilityOfPrecence", "_minCount", "_maxCount"];
        _item = a3e_arr_AmmoDepotItems select _i;
        _itemClassName = _item select 0;
        _probabilityOfPrecence = _item select 1;
        _minCount = _item select 2;
        _maxCount = _item select 3;
        if (random 100 <= _probabilityOfPrecence) then {
            _itemCount = floor (_minCount + random (_maxCount - _minCount));
            _weapons pushBack [_itemClassName, _itemCount];
        };
    };
    if (count _weapons > 0) then {
		_box = ["Box_East_Wps_F",_center,[-1.7,-1.6,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addItemCargoGlobal _x} foreach _weapons;
    };
	
    //Launchers
    _weapons = [];
    _weaponMagazines = [];
    for "_i" from 0 to (count a3e_arr_AmmoDepotLaunchers - 1) do {
        private ["_handGunItem", "_weaponClassName", "_probabilityOfPrecence", "_minCount", "_maxCount", "_magazines", "_magazinesPerWeapon"];
        _handGunItem = a3e_arr_AmmoDepotLaunchers select _i;
        _weaponClassName = _handGunItem select 0;
        _probabilityOfPrecence = _handGunItem select 1;
        _minCount = _handGunItem select 2;
        _maxCount = _handGunItem select 3;
        _magazines = _handGunItem select 4;
        _magazinesPerWeapon = _handGunItem select 5;
        if (random 100 <= _probabilityOfPrecence) then {
            _weaponCount = floor (_minCount + random (_maxCount - _minCount));
            _weapons set [count _weapons, [_weaponClassName, _weaponCount]];
            for "_j" from 0 to (count _magazines) - 1 do {
                _weaponMagazines set [count _weaponMagazines, [_magazines select _j, _weaponCount * _magazinesPerWeapon]];
            };
        };
    };
    if (count _weapons > 0 || {count _weaponMagazines > 0}) then {
		_box = ["Box_East_WpsLaunch_F",_center,[-1.7,-2.9,0.2],_rotation,0] call _fnc_createObject;
		_box allowDamage false;
        clearWeaponCargoGlobal _box;
        clearMagazineCargoGlobal _box;
        clearItemCargoGlobal _box;
		clearBackpackCargoGlobal _box;
        {_box addWeaponCargoGlobal _x} foreach _weapons;
        {_box addMagazineCargoGlobal _x} foreach _weaponMagazines;
    };

Escape_campType_arr pushback [_center,'补给点','河狸'];
publicVariable 'Escape_campType_arr';

["drn_AmmoDepotMapMarker" + str _instanceNo,_center,"o_installation"] call A3E_fnc_createLocationMarker;

_marker = createMarkerLocal ["drn_AmmoDepotPatrolMarker" + str _instanceNo, _center];
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerAlphaLocal 0;
_marker setMarkerSizeLocal [50, 50];


